import {request} from "./request";


export function findAll(data) {
  return request({
    url: '/member/findAll',
    data:
      {
        "pageNo": data.pageNo,
        "pageSize": data.pageSize
      },
      // data,
    method: 'post'
  })
}


export function increase(data) {
  return request({
    url: '/paymentDetails/add',
    data:
      {
        userid:data.userid,
        memberid:data.memberid,
        rechargeamount:data.rechargeamount,
        rechargemethod:data.rechargemethod,
        balance: ''
      },
    method: 'post'
  })
}



export function findById(data) {
  return request({
    url: '/member/findOne',
    params:
      {
        memberid: data
      },
      // data,
    method: 'post'
  })
}

export function findByUsername(data) {
  return request({
    url: '/user/findByName',
    params:
      {
        realName: data
      },
      // data,
    method: 'post'
  })
}


export function add(user) {
  return request({
    url: '/member/add',
    data:{
      realname:user.realName,
      age: user.age,
      anaphylaxis: user.anaphylaxis,
      tel: user.tel,
      sex: user.sex,
      role: 5,
      password: user.password,
      name: user.name,
      credit: user.credit,
      balance: 0,
    },
    // data,
    method: 'post'
  })
}

export function edit(user) {
  return request({
    url: '/member/add',
    data:
      {
        memberid: user.memberid,
        createdate: user.createdate,
        realname:user.realName,
        age: user.age,
        anaphylaxis: user.anaphylaxis,
        tel: user.tel,
        sex: user.sex,
        role: 5,
        password: user.password,
        name: user.name,
        credit: user.credit,
        balance: user.balance,
      },
    // data,
    method: 'post'
  })
}

export function del(id) {
  return request({
    url: '/member/del',
    params:
      {
        memberid: id
      },
    // data,
    method: 'post'
  })
}



